package org.jonas.sparksql.work

import org.apache.spark.sql.{SparkSession, SparkSessionExtensions}
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.catalyst.rules.Rule

class MyRuleExtension extends (SparkSessionExtensions => Unit) {

  override def apply(e: SparkSessionExtensions): Unit = {
    e.injectOptimizerRule { s =>
     new MyRule(s)
    }
  }
}

class MyRule(val session: SparkSession) extends Rule[LogicalPlan] {
  override def apply(plan: LogicalPlan): LogicalPlan = {
    log.warn("There is nothing!!!!!!!!!!!!!!!!!!")
    plan
  }
}
